////////////////////////////////////////////////////////
// BattleMap.cpp
////////////////////////////////////////////////////////

#include <d3d8.h>
#include "constants.h"
#include "MyEngine.h"
#include "BattleMap.h"
#include "Engine.h"

int OriginPosition;

extern CMyEngine g_Engine;

////////////////////////////////////////////////////////
// HandleOpenBattle()
////////////////////////////////////////////////////////
void HandleOpenBattle()
{

		OriginPosition = g_Engine.GetPlayer()->GetSector();
		g_Engine.SaveGame(FALSE);
        g_Engine.GetPlayer()->SetSector(1700);
        g_Engine.OpenMapFiles("Battle Map.map", FALSE);
        g_Engine.SetCurrentMap(BATTLEMAP);
        g_Engine.GetCDirect3DObj()->SetCurrentTileSurface
            (g_Engine.GetCDirect3DObj()->GetTrainingGroundsSurfaces());
        g_Engine.ResetAnimation();

}

////////////////////////////////////////////////////////
// HandleBattleMap()
////////////////////////////////////////////////////////
void HandleBattleMap()
{

  switch (g_Engine.GetPlayer()->GetSector())
    {
    case TRAININGGROUNDS:
        g_Engine.SaveGame(FALSE);
        g_Engine.GetPlayer()->SetSector(OriginPosition);
        g_Engine.OpenMapFiles("Training Grounds.map", FALSE);
        g_Engine.SetCurrentMap(TRAININGGROUNDS);
        g_Engine.GetCDirect3DObj()->SetCurrentTileSurface
            (g_Engine.GetCDirect3DObj()->GetTrainingGroundsSurfaces());
        g_Engine.ResetAnimation();
        break;
	}

}


